package com.pzh.vue.utils;

import cn.hutool.core.date.DateUtil;
import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;

import java.util.Date;

public class TokenUtils {
    public static String getToken(String userId,String password){
       return JWT.create().withAudience(userId)//user id 作为载荷
                     .withExpiresAt(DateUtil.offsetHour(new Date(),2))//有效时间
                     .sign(Algorithm.HMAC256(password));//password 作为密钥

    }
}
